#include<iostream>
#include<list>
using namespace std;
int main()
{
	list<int> l(4);
	list<int>::iterator iter;
	l.push_back(5);
	cout<<"输出后一个元素:"<<l.back()<<endl;
	cout<<"在列表头添加一个元素"<<endl;
	l.push_front(2);
	cout<<"倒转列表"<<endl;
	l.reverse();
        l.sort();
	cout<<"改变列表大小为3"<<endl;
	l.resize(3);//截断超过3之后的数字
	cout<<"输出整个列表"<<endl;
	for(iter=l.begin();iter!=l.end();iter++)
	{
		cout<<*iter<<" ";
	}
}
